<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>生产记录</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/layui.css"  media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/toastr.min.css"  media="all">
</head>
<body>
<div class="demoTable" style="padding:10px 0 0 15px">
    <div class="layui-inline" style="width: 300px">
        <input class="layui-input" name="time" id="time" autocomplete="off" placeholder="请选择时间段">
    </div>
    <button class="layui-btn layui-btn-blue" style="margin: 0 0 0 10px" data-type="reload"><i class="layui-icon layui-icon-search">  生成报表</i></button>
</div>
<table class="layui-hide" id="test" lay-filter="test"></table>

<script type="text/html" id="toolbarDemo">
	<div class="layui-btn-container">
	</div>
</script>

<script src="${pageContext.request.contextPath }/assets/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/layui.all.js"></script>
<script src="${pageContext.request.contextPath }/assets/js/jquery.min.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/js/toastr.min.js" charset="utf-8"></script>
 
<script>
layui.use(['table','layer','upload','form'], function(){
	var table = layui.table;
	var layer = layui.layer,
    form = layui.form;
	var laydate = layui.laydate;
	  
	//执行一个laydate实例
	laydate.render({
		elem: '#time' //指定元素
		,type: 'datetime'
		,range: true
	});
	var $ = layui.jquery, active = {
			reload:function () {
				var time = $("#time").val();
				console.log(time)
				if (time == '') {
					toastr.warning("请选择日期段！");
	        		return false;
				}
				table.reload('contenttable',{
					method:'get',
					where:{time: time}
				});
			}
		}
	$('.layui-btn').on('click', function(){
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
	table.render({
	    elem: '#test'
	    ,url:'${pageContext.request.contextPath }/reportMana/listPageProductRecord.do'
	    ,title: '生产记录数据表'
		,toolbar: '#toolbarDemo'
	    ,id :'contenttable'
	    ,limits:[10,20,30]
	    ,cols: [[
	      {type: 'checkbox', fixed: 'left'}
	      ,{type: 'numbers', title:'序号', fixed: 'left', width:'5%', unresize: true, sort: true}
	      ,{field:'cremark', title:'生产时间'}
	      ,{field:'pname', title:'产品名称'}
	      ,{field:'pnum', title:'产品编号'}
	      ,{field:'pmodel', title:'规格型号'}
	      ,{field:'punit', title:'计量单位'}
	      ,{field:'pnorm', title:'包装规格'}
	    ]]
	    ,page: true
	});
});

toastr.options.positionClass = 'toast-top-center'; //提示框的位置设置为中上
</script>

</body>
</html>